package com.tiantian.quanminxiu.api;

import com.tiantian.quanminxiu.utils.Constants;

import java.util.HashMap;

import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.QueryMap;
import rx.Observable;

//上传图片服务器
public interface uploadService
{

    class Factory {
        public static uploadService create() {
            Retrofit retrofit = new Retrofit.Builder()
                    .baseUrl(Constants.SERVER_URL + "mobile/")
                    .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
            return retrofit.create(uploadService.class);
        }
    }

    //region 上传头像 uploadphoto
    @Multipart
    @POST("user/user-info/avatar")
    Observable<ResponseBody> uploadphoto(@QueryMap HashMap<String, Object> params
            , @Part MultipartBody.Part file);
    //endregion

    //region 上传主播身份证 useranchorIDCard
    @Multipart
    @POST("user/user-anchor/useranchorIDCard")
    Observable<ResponseBody> useranchorIDCard(@QueryMap HashMap<String, Object> params
            , @Part MultipartBody.Part file);
    //endregion

    //region 上传主播封面 cover
    @Multipart
    @POST("user/user-anchor/cover")
    Observable<ResponseBody> cover(@QueryMap HashMap<String, Object> params
            , @Part MultipartBody.Part file);
    //endregion

}
